<template>
  <div>
    <div class="test_btns">
      <el-button @click="promote()">promote</el-button>
      <el-button @click="promotionlist()">promotionlist</el-button>
      <el-button @click="addcontact()">addcontact</el-button>
      <el-button @click="removecontact()">removecontact</el-button>
      <el-button @click="getcontact()">getcontact</el-button>
      <el-button @click="follow()">follow</el-button>
      <el-button @click="unfollow()">unfollow</el-button>
      <el-button @click="getfollowings()">getfollowings</el-button>
      <el-button @click="share()">share</el-button>
    </div>
    <div class="box_promotionlist">
      <span>推荐列表</span>
      <div v-for="(item, index) in data_promotionlist" :key="index">
        <el-card> 账号：{{ item }}</el-card>
      </div>
      <div class="box_contact">
        <span>添加好友</span>
        <el-input v-model="addcontactdata"></el-input>
      </div>
    </div>
  </div>
</template>
<script>
import {
  socketsendpromote,
  socketsendpromotionlist,
  socketsendaddcontact,
  socketsendremovecontact,
  socketsendgetcontact,
  socketsendfollow,
  socketsendunfollow,
  socketsendgetfollowings,
  socketsendshare
} from '../assets/js/websocketTest.js'
export default {
  data() {
    return {
      data_promotionlist: this.$store.state.promotionlist,
      addcontactdata: null
    }
  },
  methods: {
    promote() {
      socketsendpromote()
    },
    promotionlist() {
      socketsendpromotionlist()
    },
    addcontact() {
      this.$store.state.addcontact = this.addcontactdata
      socketsendaddcontact()
    },
    removecontact() {
      this.$store.state.addcontact = this.addcontactdata
      socketsendremovecontact()
    },
    getcontact() {
      socketsendgetcontact()
    },
    follow() {
      socketsendfollow(this.$store.state.addcontact)
    },
    unfollow() {
      socketsendunfollow()
    },
    getfollowings() {
      socketsendgetfollowings()
    },
    share() {
      socketsendshare()
    }
  },
  mounted() {
    this.promotionlist()
    this.getcontact()
    this.getfollowings()
  }
}
</script>
